<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>First Consult</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" charset="utf-8" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js">
</script>
<script type="text/javascript">
function deleteArticle(index,data){
	document.getElementById(index).disabled = true;
	jQuery.ajax({url:"Article", type:"get" , data:{data:data}, async:false, success:function(data){
	}});
}
function CommentPost(data,index){
	
var dt=document.getElementById(index).value;
	dt = dt +"$"+ data;
	 jQuery.ajax({url:"Comment", type:"post" , data:{data:dt}, async:false, success:function(data){
	}}); 
}


function display(index)
{
	alert("fr");
var element = document.getElementById(index);
alert(element);

if(element.style.display=="none")
{
	element.style="display:block;";
}
else
{

	element.style="display:none;";
}
}
</script>
</head>

<body id="framebody">
<form id="form1">
 <div id="middlePan">
		<div id="middlebodyPan">
	<jsp:useBean id="docArticleService" class="service.ViewUsersList" scope="session"></jsp:useBean>
	<%String[] articlesList = docArticleService.getArticles(request.getSession().getAttribute("docid").toString());%>
	<%	String article[]; %>
	<%	String articlesids= ""; %>
	<% if(articlesList==null){ %>
	<div align="center" style="padding: 20px;font-weight: bold;">There are no articles added by you yet!</div> 
	<%
	} else
	
	{ %>
	  <% 
		
		for( int i=0;i<articlesList.length;i++ ){ 
			article = articlesList[i].split("%");
			articlesids += article[4]+",";
		request.getSession().setAttribute("doctorid",articlesids);
		%>
	<div style="background-color: #EFEDD8; margin-top: 10px;" >
	<table style="width:100%;">
		<tr> <td style="width:87%;"> <b> <%=article[0] %>	</b></td> <td> <input type="submit" id="<%=i%>" name="delete" value="Delete"  onclick="deleteArticle('<%=i%>','<%=article[4]%>')"> </td> </tr>
		<tr> <td> &nbsp;&nbsp;<%=article[1] %> 	</td> <td>
		<tr> <td><b>Tags: </b>	&nbsp;&nbsp;&nbsp;<%=article[2] %> 
		
		<b>on</b>	&nbsp;&nbsp;&nbsp;<%=article[3] %> </td></tr>
			
		
	</table>
</div>
<% } %>
	<% } %>
		      </div>
		 	     
 </div>	
</form>	
</body>
</html>